package com.liliudong.template.biz.mapper.sys;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liliudong.template.common.entity.sys.SysMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

/**
 * SysMenuMapper
 *
 * @author ldli5
 * @classname SysMenuMapper
 * @date 2024/6/18-16:28
 */
@Mapper
public interface SysMenuMapper extends BaseMapper<SysMenu> {
	/**
	 * 按角色选择列表id忽略数据权限
	 *
	 * @param roleIds 角色ID
	 * @return {@link List }<{@link SysMenu }>
	 */
	@InterceptorIgnore(dataPermission = "true")
	List<SysMenu> selectListByRoleIdsIgnoreDataPermission(@Param("roleIds") Collection<Long> roleIds);

	/**
	 * 选择列表忽略数据权限
	 *
	 * @return {@link List }<{@link SysMenu }>
	 */
	@InterceptorIgnore(dataPermission = "true")
	@Select("SELECT * FROM sys_menu where deleted = 0")
	List<SysMenu> selectListIgnoreDataPermission();

	/**
	 * 选择角色可见列表id忽略数据权限
	 *
	 * @param roleIds 角色ID
	 * @return {@link List }<{@link SysMenu }>
	 */
	@InterceptorIgnore(dataPermission = "true")
	List<SysMenu> selectListVisibleByRoleIdsIgnoreDataPermission(@Param("roleIds") Collection<Long> roleIds);
}
